<!-- 头部导航栏 -->
<ul class="layui-nav">
    <div class="layui-nav-item">
        <span id="nickname">未登录</span>
    </div>
</ul>
<script type="text/javascript">
    // 导航栏初始化
    $(function () {
        $("#nickname").text(localStorage.getItem("nickname"));
    });
</script>